<script>
export default {
	onLaunch: function() {
    uni.login({
      success: loginRes => {
        const { code } = loginRes
        this.$http({
          url: '/doLogin',
          method: 'post',
          data: { code },
        }).then(res => {
          uni.setStorageSync('Token', res.data.token)
          uni.setStorageSync('memberId', res.data.memberId)
          this.$store.commit('setToken', res.data.token)
          this.$store.commit('setMemberId', res.data.memberId)
        })
      }
    })
	},
	onShow: function() {
		console.log('App Show');
	},
	onHide: function() {
		console.log('App Hide');
	}
};
</script>

<style>
@import './styles/styles.scss';

/* 解决头条小程序组件内引入字体不生效的问题 */
/* #ifdef MP-TOUTIAO */
@font-face {
	font-family: uniicons;
	src: url('/static/uni.ttf');
}
/* #endif */

</style>
